home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / SML40 / !Sml / Sml / LIBINFO < prev    next >
Text File  |  1990-07-04  |  3KB  |  101 lines

  1. (* SML Core language library
  2. The following library functions are provided in the SML core language:
  3.  
  4. (* Overloaded operators *)
  5.     val makestring: 'a -> string (* defined for types int,real,bool *)
  6.  
  7. (* Integer functions *)
  8.     val min: int * int -> int
  9.     val max: int * int -> int
  10.  
  11. (* String functions *)
  12.     val size: string -> int      (* returns the length of a string *)
  13.  
  14.     exception Substring
  15.     val substring: (string * int * int) -> string
  16.         (* returns the substring starting from character position
  17.        of first int argument (0 is first in string) with length of
  18.        second int argument - raises Substring if string is too small *)
  19.  
  20.     val explodeascii: string -> int list
  21.         (* fun explodeascii s = map ord (explode s) *)
  22.  
  23.     exception ImplodeAscii
  24.     val implodeascii: int list -> string
  25.         (* returns a string corresponding to the argument list of ascii
  26.        codes.  raises ImplodeAscii if a list element is <0 or >255 *)
  27.  
  28. (* List functions *)
  29.     exception Hd and Tl
  30.     val hd: 'a list -> 'a
  31.     val tl: 'a list -> 'a list
  32.         (* hd and tl return the head and tail of a list respectively,
  33.        respectively raising Hd and Tl if applied to empty lists *)
  34.  
  35.     val null: 'a list -> bool
  36.         (* returns true is arg is the empty list, false otherwise *)
  37.  
  38.     val length: 'a lsit -> int
  39.         (* returns the length of a list *)
  40.  
  41.     val map: ('a -> 'b) -> (('a list) -> ('b list)) 
  42.  
  43.     val fold: (('a * 'b) -> 'b) -> (('a list) -> ('b -> 'b))
  44.  
  45.     val revfold: (('a * 'b) -> 'b) -> (('a list) -> ('b -> 'b))
  46.  
  47.     val app: ('a -> 'b) -> (('a list) -> unit) 
  48.  
  49.     val revapp: ('a -> unit) -> (('a list) -> unit)
  50.  
  51.     exception Nth
  52.     val nth: (('a list) * int) -> 'a
  53.         (* returns the nth (0th is first element) of a list -
  54.        raises Nth if int arg is out of range *)
  55.  
  56.     val exists: (('a -> bool) * ('a list)) -> bool
  57.         (* returns true if the function f(:'a -> bool ) returns true
  58.        when applied to at least one member of the list *)
  59.  
  60. (* Reference functions *)
  61.     val inc: (int ref) -> unit
  62.     val dec: (int ref) -> unit
  63.         (* increment / decrement an int ref by 1 *)
  64.  
  65. (* Function composition *)
  66.     infix 3 o
  67.     val o: (('a -> 'b) * ('c -> 'a)) -> ('c -> 'b)
  68.  
  69. (* System and Input/Output functions *)
  70.     val stdio: unit -> (instream * outstream)
  71.         (* generates new standard input/output streams *)
  72.  
  73.     val input_line: instream -> string
  74.         (* reads a line from instream and returns as a string *)
  75.  
  76.     val execute: string -> (instream * outstream)
  77.         (* UNIX only - forks a process (named by the string arg)
  78.        from the shell and returns input and output streams for
  79.        that process *)
  80.  
  81.     val file_exists: string -> bool
  82.         (* may use relative or full pathnames for filename in UNIX *)
  83.  
  84.     val use: string -> unit
  85.         (* loads and compiles the SML programs in the named file *)
  86.  
  87.     val system: string -> unit
  88.         (* passes the string to the operating system command interpreter
  89.            for execution *)
  90.  
  91.     val CpuTime: unit -> int
  92.     (* returns milliseconds used by process *)
  93.     val ExportML: (string * string * (string list)) -> unit
  94.         (* create a new saved state for SML:
  95.        arg 1 - filename for saved state
  96.        arg 2 - startup message
  97.        arg 3 - list of files to be "use"d on startup *)
  98.     
  99. *)
  100. (***************************************************************************)
  101.